﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="ManageRoles.aspx.cs" Inherits="Se7en.Admin.Web.Pages.ManageRole" %>

<%@ Register Src="../Controls/RoleEdit.ascx" TagName="RoleEdit" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:UpdatePanel ID="UPRoles" runat="server">
        <ContentTemplate>
            <asp:Panel ID="pnSearch" runat="server" DefaultButton="btnSearch">
                <b>Role Type:</b>
                <asp:DropDownList ID="ddlRoleType" runat="server" Width="150px" AutoPostBack="true"
                    OnSelectedIndexChanged="ddlRoleType_SelectedIndexChanged">
                </asp:DropDownList>
                <asp:Button ID="btnSearch" runat="server" Text="Search" OnClick="btnSearch_Click"
                    Visible="false" />
            </asp:Panel>
            <asp:Label runat="server" ID="lblError" ForeColor="Red" />
            <erm:ERMGrid ID="grdRole" runat="server" ShowRecordIndex="true" EnableRowClick="false"
                PageSize="10" OnRefresh="grdRole_Refresh" OnPageIndexChanged="grdRole_PageIndexChanged"
                AutoGenerateColumns="false" DataKeyNames="RoleId" EnableRowHover="true" Width="100%"
                GridStyle="SkyBlue" EnableMultiSelect="false" OnActionClick="grdRole_ActionClick"
                OnRowDataBound="grdRole_RowDataBound" OnAddNew="grdRole_AddNew" OnDelete="grdRole_Delete">
                <Menu Position="Top" VisibleDelete="false" />
                <Columns>
                    <asp:BoundField HeaderText="Role Name" DataField="Name" ItemStyle-Width="30%" />
                    <asp:BoundField HeaderText="Description" DataField="Description" />
                    <asp:TemplateField HeaderText="Is Default" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <asp:RadioButton ID="rdoIsDefault" Checked='<%# GetIsDefaultRole(Eval("RoleId"))%>'
                                runat="server" onclick="CheckOne(this)" ValidationGroup='<%# Eval("RoleId")%>'
                                OnCheckedChanged="rdoIsDefault_CheckedChanged" AutoPostBack="true" />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <erm:ActionColumn HeaderText="Actions" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                        ItemStyle-Width="15%">
                        <Actions>
                            <erm:Action Name="Edit" Text="Edit" ToolTip="Edit" />
                            <erm:Action Name="Delete" Text="Delete" ToolTip="Delete Role" ConfirmMessage="Are you sure want to delete this role?" />
                        </Actions>
                    </erm:ActionColumn>
                </Columns>
            </erm:ERMGrid>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="ctlRoleEdit" EventName="Success" />
            <asp:AsyncPostBackTrigger ControlID="ctlRoleEdit" EventName="Fail" />
        </Triggers>
    </asp:UpdatePanel>
    <erm:ErmGroupBox ID="pnlRole" runat="server" Width="500px" IsModal="true" ModalBehaviorId="bhvRole"
        HeaderText="Role Information" Style="display: none">
        <ContentTemplate>
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
                    <uc1:RoleEdit ID="ctlRoleEdit" runat="server" OnCancelClientClick="$find('bhvRole').hide(); return false;"
                        OnSuccess="ctlRoleEdit_Success" />
                </ContentTemplate>
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="grdRole" EventName="AddNew" />
                </Triggers>
            </asp:UpdatePanel>
        </ContentTemplate>
    </erm:ErmGroupBox>
    <asp:HyperLink ID="HyperLink1" runat="server"></asp:HyperLink>
    <ajax:ModalPopupExtender ID="modalRole" runat="server" PopupControlID="pnlRole" BehaviorID="bhvRole"
        TargetControlID="HyperLink1" BackgroundCssClass="modalBackground">
    </ajax:ModalPopupExtender>
</asp:Content>
